From: Florian Müllner Date: Fri, 24 Jan 2020 01:02:10 +0000 (+0100) Subject: extensionPrefs: Move description into a expander X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~43 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=1067642300b0e147dc49dcbbfe946ccf37884962;p=gnome-shell.git extensionPrefs: Move description into a expander The description can be useful information, but also increases the visual complexity of the extensions list. Move it into a hidden details area that can be expanded, which unclutters the interface while keeping the information readily available. https://gitlab.gnome.org/GNOME/gnome-shell/issues/1968 --- diff --git a/js/extensionPrefs/css/application.css b/js/extensionPrefs/css/application.css new file mode 100644 index 000000000..1a35205f1 --- /dev/null +++ b/js/extensionPrefs/css/application.css @@ -0,0 +1,9 @@ +.details-button image { + transition: 250ms; +} +.details-button.expanded:dir(ltr) image { + -gtk-icon-transform: rotate(0.25turn); +} +.details-button.expanded:dir(rtl) image { + -gtk-icon-transform: rotate(-0.25turn); +} diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js index ac9169ba5..99dfddd9f 100644 --- a/js/extensionPrefs/main.js +++ b/js/extensionPrefs/main.js @@ -44,6 +44,17 @@ class Application extends Gtk.Application { vfunc_startup() { super.vfunc_startup(); + let provider = new Gtk.CssProvider(); + let uri = 'resource:///org/gnome/shell/css/application.css'; + try { + provider.load_from_file(Gio.File.new_for_uri(uri)); + } catch (e) { + logError(e, 'Failed to add application style'); + } + Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), + provider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + this._shellProxy = new GnomeShellProxy(Gio.DBus.session, 'org.gnome.Shell', '/org/gnome/Shell'); this._window = new ExtensionsWindow({ application: this }); } @@ -472,6 +483,8 @@ var ExtensionRow = GObject.registerClass({ InternalChildren: [ 'nameLabel', 'descriptionLabel', + 'revealButton', + 'revealer', ], }, class ExtensionRow extends Gtk.ListBoxRow { _init(extension) { @@ -514,6 +527,16 @@ var ExtensionRow = GObject.registerClass({ let desc = this._extension.metadata.description.split('\n')[0]; this._descriptionLabel.label = desc; + this._revealButton.connect('clicked', () => { + this._revealer.reveal_child = !this._revealer.reveal_child; + }); + this._revealer.connect('notify::reveal-child', () => { + if (this._revealer.reveal_child) + this._revealButton.get_style_context().add_class('expanded'); + else + this._revealButton.get_style_context().remove_class('expanded'); + }); + this.connect('destroy', this._onDestroy.bind(this)); this._extensionStateChangedId = this._app.shellProxy.connectSignal( diff --git a/js/extensionPrefs/ui/extension-row.ui b/js/extensionPrefs/ui/extension-row.ui index 99ea655e1..23231e2b9 100644 --- a/js/extensionPrefs/ui/extension-row.ui +++ b/js/extensionPrefs/ui/extension-row.ui @@ -8,20 +8,13 @@ True - 12 - 24 - 12 - 12 - 6 - 24 + 12 + 12 True True start - - - @@ -46,9 +39,6 @@ - - 2 - @@ -57,21 +47,66 @@ center row.enabled - - 2 - - + + True + + + + True - end - 60 - 0 - 0 + True + True + center + + + + True + pan-end-symbolic + + + + + + + True + + + True + 12 + 6 + 12 + + + True + Description + 0 + + + + + + True + end + 60 + 0 + 0 + + + + 0 1 + 5 diff --git a/js/prefs-resources.gresource.xml b/js/prefs-resources.gresource.xml index 193d305d0..11b9b5aa5 100644 --- a/js/prefs-resources.gresource.xml +++ b/js/prefs-resources.gresource.xml @@ -8,6 +8,8 @@ misc/fileUtils.js misc/params.js + extensionPrefs/css/application.css + extensionPrefs/ui/extension-row.ui extensionPrefs/ui/extensions-window.ui